package com.shopping.serviceImpl;

import com.shopping.dao.OrderItemDao;
import com.shopping.pojo.OrderItem;
import com.shopping.pojo.vo.OrdersInfo;
import com.shopping.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderItemServiceImpl implements OrderItemService {
    @Autowired
    private OrderItemDao orderItemDao;

    @Override
    public List<OrderItem> selectOrderItemByOrderId(Integer id) {
        return orderItemDao.selectOrderItemByOrderId(id);
    }

    @Override
    public int getOrderItemNum(Integer id) {
        return orderItemDao.getOrderItemNum(id);
    }

    @Override
    public boolean checkOrdersStatusByBusinessId(String businessId) {
        return orderItemDao.checkOrdersStatusByBusinessId(businessId)>0;
    }

    @Override
    public boolean checkOrdersStatusByProductId(Integer productId) {
        return orderItemDao.checkOrdersStatusByProductId(productId)>0;
    }

    @Override
    public int getUndeliveredNum(String businessId) {
        return orderItemDao.getUndeliveredNum(businessId);
    }

    @Override
    public int getShippedNum(String businessId) {
        return orderItemDao.getShippedNum(businessId);
    }

    @Override
    public int getReceivedNum(String businessId) {
        return orderItemDao.getReceivedNum(businessId);
    }

    @Override
    public boolean updateOrderItemReceipt(Integer id) {
        return orderItemDao.updateOrderItemReceipt(id)>0;
    }

    @Override
    public boolean insertOrderItem(OrderItem orderItem) {
        return orderItemDao.insertOrderItem(orderItem)>0;
    }

    @Override
    public boolean updateOrderStatus(String orderId) {
        return orderItemDao.updateOrderStatus(orderId)>0;
    }

}
